<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
      .main {
        --gap: 20;
        margin-top: calc(var(--gap) * 1px);
      }
    </style>
  </head>
  <body>
    <div class="main">上外边距设置为20px</div>
  </body>
</html>